package com.nebula.controller.user;

import com.nebula.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ApplicationRunner implements CommandLineRunner {

    @Autowired
    private DishController dishController;

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public void run(String... args) throws Exception {
        // 从数据库加载所有商品ID
        List<Long> categoryIds = categoryMapper.getAllId();// ... 从数据库获取所有商品ID
        // 初始化布隆过滤器
        dishController.initBloomFilter(categoryIds);

    }
}
